home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / mach / sun3.md / machEeprom.c < prev    next >
C/C++ Source or Header  |  1990-02-20  |  6KB  |  225 lines

  1. /* 
  2.  * machEeprom.c --
  3.  *
  4.  *    Interface to the EEPROM o the Sun 3.
  5.  *
  6.  * Copyright 1990 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/kernel/mach/sun3.md/RCS/machEeprom.c,v 1.2 90/02/20 15:38:17 brent Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include "sprite.h"
  21. #include "machConst.h"
  22. #include "machMon.h"
  23. #include "machEeprom.h"
  24. #include "machInt.h"
  25. #include "mach.h"
  26. #include "sys.h"
  27.  
  28.  
  29. /*
  30.  *----------------------------------------------------------------------
  31.  *
  32.  * Mach_EepromPrintConfig --
  33.  *
  34.  *    Print system configuration information from the EEPROM.    
  35.  *
  36.  * Results:
  37.  *    None.
  38.  *
  39.  * Side effects:
  40.  *    None.
  41.  *
  42.  *----------------------------------------------------------------------
  43.  */
  44.  
  45. void
  46. Mach_EepromPrintConfig()
  47. {
  48.     struct eed_conf *confPtr;
  49.     int slot;
  50.  
  51.     confPtr = &machEepromPtr->ee_diag.eed_conf[0];
  52.     for (slot=0 ; slot<MACH_MAX_SLOTS ; slot++, confPtr++) {
  53.     if (confPtr->eec_un.eec_gen.eec_type == MACH_SLOT_TYPE_NONE) {
  54.         continue;
  55.     }
  56.     printf ("Slot %d (%x): ", slot, confPtr->eec_un.eec_gen.eec_type);
  57.     switch (confPtr->eec_un.eec_gen.eec_type) {
  58.         case MACH_SLOT_TYPE_CPU:
  59.         printf(" CPU with %d Meg %s %s cache %d Kbytes\n",
  60.             confPtr->eec_un.eec_cpu.eec_cpu_memsize,
  61.             confPtr->eec_un.eec_cpu.eec_cpu_dcp ? "DCP" : "",
  62.             confPtr->eec_un.eec_cpu.eec_cpu_68881 ? "68881" : "",
  63.             confPtr->eec_un.eec_cpu.eec_cpu_cachesize);
  64.         break;
  65.         case MACH_SLOT_TYPE_MEM:
  66.         printf(" Memory %8d bytes",
  67.             confPtr->eec_un.eec_mem.eec_mem_size);
  68.         break;
  69.         case MACH_SLOT_TYPE_COLOR:
  70.         printf(" Color type %d",
  71.             confPtr->eec_un.eec_color.eec_color_type);
  72.         break;
  73.         case MACH_SLOT_TYPE_BW:
  74.         printf(" Black & White");
  75.         break;
  76.         case MACH_SLOT_TYPE_FPA:
  77.         printf(" Floating Point Accelerator");
  78.         break;
  79.         case MACH_SLOT_TYPE_DISK:
  80.         printf(" %s #%d disks %d",
  81.             (confPtr->eec_un.eec_disk.eec_disk_type ==
  82.             MACH_SLOT_DISK_TYPE_X450) ? "Xylogics 450"
  83.                           : "Xylogics 451",
  84.             confPtr->eec_un.eec_disk.eec_disk_ctlr,
  85.             confPtr->eec_un.eec_disk.eec_disk_disks);
  86.         break;
  87.         case MACH_SLOT_TYPE_TAPE:
  88.         printf(" 1/2\" Tape #%d tapes %d",
  89.             (confPtr->eec_un.eec_tape.eec_tape_type ==
  90.             MACH_SLOT_TAPE_TYPE_XT) ? "Xylogics 472"
  91.                           : "TapeMaster",
  92.             confPtr->eec_un.eec_tape.eec_tape_ctlr,
  93.             confPtr->eec_un.eec_tape.eec_tape_drives);
  94.         break;
  95.         case MACH_SLOT_TYPE_TTY:
  96.         printf(" TTY");
  97.         break;
  98.         case MACH_SLOT_TYPE_GP:
  99.         printf(" GP");
  100.         break;
  101.         case MACH_SLOT_TYPE_DCP:
  102.         printf(" DCP");
  103.         break;
  104.         case MACH_SLOT_TYPE_SCSI:
  105.         printf(" SCSI-%d, %d tapes type #%d,  %d disks type #%d",
  106.             confPtr->eec_un.eec_scsi.eec_scsi_type,
  107.             confPtr->eec_un.eec_scsi.eec_scsi_tapes,
  108.             confPtr->eec_un.eec_scsi.eec_scsi_tape_type,
  109.             confPtr->eec_un.eec_scsi.eec_scsi_disks,
  110.             confPtr->eec_un.eec_scsi.eec_scsi_disk_type);
  111.         break;
  112.         case MACH_SLOT_TYPE_IPC:
  113.         printf(" IPC");
  114.         break;
  115.         case MACH_SLOT_TYPE_GB:
  116.         printf(" GB");
  117.         break;
  118.         case MACH_SLOT_TYPE_SCSI375:
  119.         printf(" SCSI 3/75");
  120.         break;
  121.         case MACH_SLOT_TYPE_MAPKIT:
  122.         printf(" MapKit");
  123.         break;
  124.         case MACH_SLOT_TYPE_CHANNEL:
  125.         printf(" Channel");
  126.         break;
  127.         case MACH_SLOT_TYPE_END:
  128.         printf(" End of Card Cage");
  129.         break;
  130.     }
  131.     printf("\n");
  132.     }
  133. }
  134.  
  135. /*
  136.  *----------------------------------------------------------------------
  137.  *
  138.  * Mach_EepromGetConfig --
  139.  *
  140.  *    Return system configuration information from the EEPROM.    
  141.  *
  142.  * Results:
  143.  *    None.
  144.  *
  145.  * Side effects:
  146.  *    None.
  147.  *
  148.  *----------------------------------------------------------------------
  149.  */
  150.  
  151. void
  152. Mach_EepromGetConfig(cpuPtr, memSizePtr, colorPtr, fpuPtr)
  153.     Mach_CpuConfig *cpuPtr;        /* Not implemented */
  154.     unsigned int *memSizePtr;        /* Number of bytes */
  155.     Mach_ColorConfig *colorPtr;        /* Color frame buffer info */
  156.     Mach_FpuConfig *fpuPtr;        /* FPU info */
  157. {
  158.     struct eed_conf *confPtr;
  159.     int slot;
  160.     unsigned int memSize = 0;
  161.  
  162.     fpuPtr->valid = 0;
  163.     colorPtr->valid = 0;
  164.  
  165.     confPtr = &machEepromPtr->ee_diag.eed_conf[0];
  166.     for (slot=0 ; slot<MACH_MAX_SLOTS ; slot++, confPtr++) {
  167.     if (confPtr->eec_un.eec_gen.eec_type == MACH_SLOT_TYPE_NONE) {
  168.         continue;
  169.     }
  170.     switch (confPtr->eec_un.eec_gen.eec_type) {
  171.         case MACH_SLOT_TYPE_CPU:
  172.         break;
  173.         case MACH_SLOT_TYPE_COLOR:
  174.         colorPtr->valid = 1;
  175.         colorPtr->type = confPtr->eec_un.eec_color.eec_color_type;
  176.         break;
  177.         case MACH_SLOT_TYPE_MEM:
  178.         memSize += confPtr->eec_un.eec_mem.eec_mem_size * 1024 * 1024;
  179.         break;
  180.         case MACH_SLOT_TYPE_FPA:
  181.         fpuPtr->valid = 1;
  182.         break;
  183.     }
  184.     }
  185.     *memSizePtr = memSize;
  186. }
  187.  
  188. /*
  189.  *----------------------------------------------------------------------
  190.  *
  191.  * Mach_ColorBoardInfo --
  192.  *
  193.  *    Return configuration information about the color board, if any.    
  194.  *
  195.  * Results:
  196.  *    None.
  197.  *
  198.  * Side effects:
  199.  *    None.
  200.  *
  201.  *----------------------------------------------------------------------
  202.  */
  203.  
  204. Boolean
  205. Mach_ColorBoardInfo(colorPtr)
  206.     Mach_ColorConfig *colorPtr;        /* Color frame buffer info */
  207. {
  208.     unsigned int memSize;
  209.     Mach_CpuConfig cpu;
  210.     Mach_FpuConfig fpu;
  211.  
  212.     Mach_EepromGetConfig(&cpu, &memSize, colorPtr, &fpu);
  213.     switch (Mach_GetMachineType()) {
  214.     case SYS_SUN_3_60:
  215.         /*
  216.          * These are the hardware page fram numbers suitable for
  217.          * putting into a PTE.
  218.          */
  219.         colorPtr->firstPage = 0xfc00;
  220.         colorPtr->lastPage =  0xfc7f;
  221.         break;
  222.     }
  223.     return(colorPtr->valid);
  224. }
  225.